unit DbManager;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,

  FormUtils, FormBaseEdit,

  cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy, dxSkinGlassOceans,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSharp, dxSkinSilver, dxSkinSpringTime,
  dxSkinStardust, dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, dxSkinscxPCPainter, Menus, dxLayoutControl, StdCtrls,
  cxButtons, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit,
  DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView,
  cxGridTableView, cxGridDBTableView, cxGrid, DBClient, cxDropDownEdit, Provider, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxLayoutControlAdapters, dxLayoutContainer;

type
  TfmDbManager = class(TfmBaseEdit)
    vwDbList: TcxGridDBTableView;
    lvDbList: TcxGridLevel;
    grDbList: TcxGrid;
    liGrid: TdxLayoutItem;
    srDbList: TDataSource;
    dsDbList: TClientDataSet;
    dsDbListDB_NAME: TStringField;
    dsDbListDB_SERVER: TStringField;
    dsDbListDB_USER: TStringField;
    dsDbListDB_PASSWORD: TStringField;
    vwDbListDB_SERVER: TcxGridDBColumn;
    vwDbListDB_NAME: TcxGridDBColumn;
    vwDbListDB_USER: TcxGridDBColumn;
    vwDbListDB_PASSWORD: TcxGridDBColumn;
    btnSave: TcxButton;
    lcWindowItem1: TdxLayoutItem;
    dsDbListDB_ROLE: TStringField;
    vwDbListDB_ROLE: TcxGridDBColumn;
    DataSetProvider: TDataSetProvider;
    procedure FormCreate(Sender: TObject);
    procedure btnSaveClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmDbManager: TfmDbManager;

implementation
uses AppConst;
{$R *.dfm}

procedure TfmDbManager.btnSaveClick(Sender: TObject);
begin
  inherited;
  dsDbList.SaveToFile(AppRootDir + 'DbList.xml', dfXML); //dfBinary, dfXML, dfXMLUTF8
end;

procedure TfmDbManager.FormCreate(Sender: TObject);
begin
  inherited;
  FormMode := fmdDialog;
  dsDbList.FileName := AppRootDir + 'DbList.xml';
  dsDbList.Open;
  //dsDbList.LoadFromFile(AppRootDir + 'DbList.xml');
end;

end.
